home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DOS.SWG / 0025_Detecting SHARE.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-27  |  1KB  |  41 lines

  1. {
  2. LARS HELLSTEN
  3.  
  4. > I would like to open a few Files in READ, DENY Write mode.  I can get the r
  5. > part (just a reset), but not the DENY Write.  How can I accomplish this in
  6. > Turbo Pascal Without locking specific Records or parts of Files, or the who
  7. > File... or is that what is required?
  8.  
  9. You can accomplish that by changing the FileMODE Variable.  I
  10. don't know if that's what you're looking for, or already know this,
  11. but, here's a table of FileMODE values:
  12.                                       Sharing Method
  13. Access Method  Compatibility  Deny Write  Deny Read  Deny None
  14. --------------------------------------------------------------
  15. Read Only           0             32          48         64
  16. Write Only          1             33          49         65
  17. Read/Write          2             34          50         66
  18. --------------------------------------------------------------
  19.  
  20.    So, as you can see, all you need to do is set the FileMODE to 32.  Just
  21. put the satement "FileMode := 32;" in before you reset the File.  This will
  22. only work With Dos' SHARE installed, or a compatible network BIOS.  if you
  23. need a routine to detect SHARE, here's one:
  24. }
  25.  
  26. Uses
  27.   Dos;
  28.  
  29. Function ShareInstalled : Boolean;
  30. Var
  31.   Regs : Registers;
  32. begin
  33.   Regs.AH := $16;
  34.   Regs.AL := $00;
  35.   Intr($21, Regs);
  36.   ShareInstalled := (Regs.AL = $FF);
  37. end;
  38.  
  39. begin
  40.   Writeln('Share: ', ShareInstalled);
  41. end.